package cn.ihrm.sass.config;

import io.swagger.annotations.ApiOperation;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * @author Mxb
 * @version 1.0
 * @date 2020/6/29 18:16
 */
@Configuration
@EnableSwagger2  //启用swagger
public class Swagger2AutoConfiguration {
    @Bean
    public Docket swaggerSpringMvcPlugin() {
        return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()).select()
                .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)).build();
    }
    private ApiInfo apiInfo() {
        return new ApiInfoBuilder().description("Ihrm接口文档")
                //.contact(new Contact("小兵", "#", "123@qq.com"))  //名片
                //.version("1.0")  //版本
                //.license("小兵")//所有者
                .build();//构造
    }
}